<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <!-- 搜索 -->
      <el-input v-model="queryList.danwei" clearable placeholder="单位名称" style="width: 110px;" class="filter-item" size="mini"/>
      <!--添加日期 暂时先不做
      <el-date-picker v-model="queryList.tjrqdate" :picker-options="pickerOptions2" class="filter-item" size="mini" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="添加日期:开始" end-placeholder="添加日期:结束"/>-->
      <el-cascader :options="options" v-model="queryList.shengshixian" multiple placeholder="请选择地址" clearable size="mini" expand-trigger="hover" class="filter-item" @change="handleChange"/>
      <!-- <el-input v-model="queryList.zxhte" clearable placeholder="最小合同额" style="width: 110px;" class="filter-item" size="mini"/><span>~</span>
      <el-input v-model="queryList.zdhte" clearable placeholder="最大合同额" style="width: 110px;" class="filter-item" size="mini"/>
      --><!-- 下面没定义变量 -->
      <el-select v-model="queryList.iskaipiao" placeholder="是否开票" clearable size="mini" class="filter-item" style="width: 100px">
        <el-option label="已开票" value="已开票"/>
        <el-option label="未开票" value="未开票"/>
      </el-select>
      <!--暂时先不做  开票日期
      <el-date-picker v-model="queryList.kprqdate" :picker-options="pickerOptions2" class="filter-item" size="mini" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开票日期:开始" end-placeholder="开票日期:结束"/>
      -->
      <!-- <el-input v-model="queryList.zxhke" clearable placeholder="最小回款额" style="width: 110px;" class="filter-item" size="mini"/><span>~</span>
      <el-input v-model="queryList.zdhke" clearable placeholder="最大回款额" style="width: 110px;" class="filter-item" size="mini"/>
      -->
      <!--回款日期  暂时先不做
      <el-date-picker v-model="queryList.hkrqdate" :picker-options="pickerOptions2" class="filter-item" size="mini" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="回款日期:开始" end-placeholder="回款日期:结束"/>
       -->
      <el-select v-model="queryList.htjc" clearable placeholder="合同寄回" size="mini" class="filter-item" style="width: 100px">
        <el-option label="已寄回" value="已寄回"/>
        <el-option label="未寄回" value="未寄回"/>
      </el-select>
      <el-select v-model="queryList.jqfc" clearable placeholder="机器发出" size="mini" class="filter-item" style="width: 100px">
        <el-option label="已发出" value="已发出"/>
        <el-option label="未发出" value="未发出"/>
      </el-select>
      <el-select v-model="queryList.isbushu" clearable placeholder="是否部署" size="mini" class="filter-item" style="width: 100px">
        <el-option label="已部署" value="已部署"/>
        <el-option label="未部署" value="未部署"/>
      </el-select>
      <el-select v-model="queryList.bsr" clearable placeholder="部署人" size="mini" class="filter-item" style="width: 100px">
        <el-option v-for="item in dictMap.ygmc" :key="item.value" :label="item.value" :value="item.value"/>
      </el-select>
      <el-input v-model="queryList.lxr" clearable placeholder="联系人" style="width: 110px;" class="filter-item" size="mini"/>
      <el-select v-model="queryList.zhlx" clearable placeholder="账户类型" size="mini" class="filter-item" style="width: 100px">
        <el-option v-for="item in dictMap.gslx" :key="item.value" :label="item.value" :value="item.value"/>
      </el-select>
      <el-select v-model="queryList.pc" clearable placeholder="批次" size="mini" class="filter-item" style="width: 100px">
        <el-option v-for="item in dictMap.pici" :key="item.value" :label="item.value" :value="item.value"/>
      </el-select>
      <!--部署日期  暂时先不做
      <el-date-picker v-model="queryList.bsrqdate" :picker-options="pickerOptions2" class="filter-item" size="mini" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="部署日期:开始" end-placeholder="部署日期:结束"/>
      -->
      <el-select v-model="queryList.htfzr" clearable placeholder="合同负责人" size="mini" class="filter-item" style="width: 140px">
        <el-option v-for="item in dictMap.ygmc" :key="item.value" :label="item.value" :value="item.value"/>
      </el-select>
      <!-- <el-select v-model="queryList.shangpin" clearable multiple collapse-tags placeholder="包含货物" size="mini" class="filter-item" style="width: 180px">
        <el-option-group
          v-for="group in shangpin"
          :key="group.label"
          :label="group.label">
          <el-option v-for="item in group.options" :key="item.value" :label="item.label" :value="item.value"/>
        </el-option-group>
      </el-select>-->
      <!-- 上面没定义变量 -->
      <el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
      <!-- 新增 -->
      <div style="display: inline-block;margin: 0px 2px;">
        <el-button
          v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_CREATE']"
          class="filter-item"
          size="mini"
          type="primary"
          icon="el-icon-plus"
          @click="add">新增</el-button>
      </div>
      <div style="display: inline-block;">
        <el-button
          v-permission="['ADMIN']"
          :loading="downloadLoading"
          size="mini"
          class="filter-item"
          type="warning"
          icon="el-icon-download"
          @click="download">导出</el-button>
      </div>
      <div style="display: inline-block;">
        <el-button class="filter-item" size="mini" @click="clearFilter">清除所有过滤器</el-button>
      </div>
    </div>
    <!--表单组件-->
    <eForm ref="form" :is-add="isAdd"/>
    <!--表格渲染-->
    <el-table
      v-loading="loading"
      ref="filterTable"
      :data="data"
      :expand-row-keys="expands"
      :row-key="getRowKeys"
      height="600"
      size="small"
      style="width: 100%;"
      stripe
      border
      @expand-change="test">
      <el-drawer
        :visible.sync="drawer"
        direction="ltr"
        title="物流跟踪">
        <span>
          <el-timeline :reverse="false">
            <el-timeline-item
              v-for="(activity, index) in activities"
              :key="index"
              :timestamp="activity.time">
              {{ activity.context }}
            </el-timeline-item>
          </el-timeline>
        </span>
      </el-drawer>
      <!--<el-table-column fixed="left" type="expand">
        <template slot-scope="props">
          <div style="display: inline-block;margin: 0px 2px;">
            <el-button
              v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_CREATE','kuguan']"
              class="filter-item"
              size="mini"
              type="primary"
              icon="el-icon-plus"
              @click="addGoods(props.row.id)">新增</el-button>
          </div>
          <goodsForm ref="goodsForm" :is-add="isAdd"/>
          <el-table v-loading="loading" :data="goods" size="small" style="width: 60%;" border>
            <el-table-column label="产品名称" prop="goodname"/>
            <el-table-column label="产品数量" prop="goodcount"/>
            <el-table-column label="产品价格" prop="goodprice"/>
            <el-table-column v-if="checkPermission(['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','BUSHUTONGJI_DELETE','kuguan'])" fixed="right" label="操作" width="150px" align="center">
              <template slot-scope="scope">
                <el-button v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','kuguan']" size="mini" type="primary" icon="el-icon-edit" @click="editGoods(scope.row)"/>
                <el-popover
                  v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_DELETE','kuguan']"
                  :ref="scope.row.id"
                  placement="top"
                  width="180">
                  <p>确定删除本条数据吗？</p>
                  <div style="text-align: right; margin: 0">
                    <el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
                    <el-button :loading="delGoodsLoading" type="primary" size="mini" @click="subDeleteGoods(scope.row.id)">确定</el-button>
                  </div>
                  <el-button slot="reference" type="danger" icon="el-icon-delete" size="mini"/>
                </el-popover>
              </template>
            </el-table-column>
          </el-table>
        </template>
      </el-table-column>-->
      <el-table-column prop="createtime" sortable label="添加日期" width="95">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createtime).toString().substring(0,10) }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="sheng" label="省份"/>
      <el-table-column
        :filters="[{text: '南宁市', value: '南宁市'}, {text: '贺州市', value: '贺州市'}, {text: '来宾市', value: '来宾市'}, {text: '贵港市', value: '贵港市'}, {text: '玉林市', value: '玉林市'}, {text: '崇左市', value: '崇左市'}, {text: '防城港市', value: '防城港市'}, {text: '桂林市', value: '桂林市'}, {text: '河池市', value: '河池市'}, {text: '百色市', value: '百色市'}, {text: '柳州市', value: '柳州市'}, {text: '北海市', value: '北海市'}, {text: '钦州市', value: '钦州市'}, {text: '梧州市', value: '梧州市'}]"
        :filter-method="filterHandler"
        prop="city"
        label="城市"
      />
      <el-table-column prop="xian" label="县区"/>
      <el-table-column fixed="left" type="expand">
        <template slot-scope="props">
          <el-form label-position="left" style="margin-left: 150px" inline class="demo-table-expand">
            <el-card class="box-card" style="width: 1100px;margin-top: 3px" shadow="hover">
              <el-form-item label="合同负责人:">
                <span>{{ props.row.hetongfuzeren }}</span>
              </el-form-item>
              <el-form-item label="主机总数:">
                <span>{{ props.row.zhujishuliang }}</span>
              </el-form-item>
              <el-form-item label="联系人:">
                <span>{{ props.row.lianxiren }}</span>
              </el-form-item>
              <el-form-item label="联系电话:">
                <span>{{ props.row.lianxidianhua }}</span>
              </el-form-item>
            </el-card>
            <el-card class="box-card" style="width: 1100px;background-color: #F2F6FC" shadow="hover">
              <el-form-item v-if="props.row.hfwuyaoling < 1" v-show="false" label="HF510:">
                <span>{{ props.row.hfwuyaoling }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.hfwuyaoling >0" v-show="true" label="HF510:">
                <span>{{ props.row.hfwuyaoling }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.hfwubaling < 1" v-show="false" label="HF580:">
                <span>{{ props.row.hfwubaling }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.hfwubaling >0" v-show="true" label="HF580:">
                <span>{{ props.row.hfwubaling }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.zfwuyaoling < 1" v-show="false" label="ZF510:">
                <span>{{ props.row.zfwuyaoling }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.zfwuyaoling >0" v-show="true" label="ZF510:">
                <span>{{ props.row.zfwuyaoling }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.zfwuyaoqi < 1" v-show="false" label="ZF517:">
                <span>{{ props.row.zfwuyaoqi }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.zfwuyaoqi >0" v-show="true" label="ZF517:">
                <span>{{ props.row.zfwuyaoqi }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.chaoxiang < 1" v-show="false" label="超翔(同方台式):">
                <span>{{ props.row.chaoxiang }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.chaoxiang >0" v-show="true" label="超翔(同方台式):">
                <span>{{ props.row.chaoxiang }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.chaorui < 1" v-show="false" label="超锐(同方便携):">
                <span>{{ props.row.chaorui }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.chaorui >0" v-show="true" label="超锐(同方便携):">
                <span>{{ props.row.chaorui }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.zhaoyang < 1" v-show="false" label="昭阳(联想便携):">
                <span>{{ props.row.zhaoyang }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.zhaoyang >0" v-show="true" label="昭阳(联想便携):">
                <span>{{ props.row.zhaoyang }}</span>
              </el-form-item>
            </el-card>
            <el-card class="box-card" style="width: 1100px;" shadow="hover">
              <el-form-item v-if="props.row.shuke < 1" v-show="false" label="数科:">
                <span>{{ props.row.shuke }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.shuke >0" v-show="true" label="数科:">
                <span>{{ props.row.shuke }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.jinshan < 1" v-show="false" label="金山:">
                <span>{{ props.row.jinshan }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.jinshan >0" v-show="true" label="金山:">
                <span>{{ props.row.jinshan }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.yongzhong < 1" v-show="false" label="永中:">
                <span>{{ props.row.yongzhong }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.yongzhong >0" v-show="true" label="永中:">
                <span>{{ props.row.yongzhong }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.antian < 1" v-show="false" label="安天:">
                <span>{{ props.row.antian }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.antian >0" v-show="true" label="安天:">
                <span>{{ props.row.antian }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.sanliuling < 1" v-show="false" label="360:">
                <span>{{ props.row.sanliuling }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.sanliuling >0" v-show="true" label="360:">
                <span>{{ props.row.sanliuling }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.zhongfusanheyi < 1" v-show="false" label="中孚三合一:">
                <span>{{ props.row.zhongfusanheyi }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.zhongfusanheyi >0" v-show="true" label="中孚三合一:">
                <span>{{ props.row.zhongfusanheyi }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.wanlihongsanheyi < 1" v-show="false" label="万里红三合一:">
                <span>{{ props.row.wanlihongsanheyi }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.wanlihongsanheyi >0" v-show="true" label="万里红三合一:">
                <span>{{ props.row.wanlihongsanheyi }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.zhongfuzhushen < 1" v-show="false" label="中孚主审:">
                <span>{{ props.row.zhongfuzhushen }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.zhongfuzhushen >0" v-show="true" label="中孚主审:">
                <span>{{ props.row.zhongfuzhushen }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.wanlihongzhushen < 1" v-show="false" label="万里红主审:">
                <span>{{ props.row.wanlihongzhushen }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.wanlihongzhushen >0" v-show="true" label="万里红主审:">
                <span>{{ props.row.wanlihongzhushen }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.hanbangzhushen < 1" v-show="false" label="汉邦主审:">
                <span>{{ props.row.hanbangzhushen }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.hanbangzhushen >0" v-show="true" label="汉邦主审:">
                <span>{{ props.row.hanbangzhushen }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.beixinyuanshenfenjianbie < 1" v-show="false" label="北信源身份鉴别:">
                <span>{{ props.row.beixinyuanshenfenjianbie }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.beixinyuanshenfenjianbie >0" v-show="true" label="北信源身份鉴别:">
                <span>{{ props.row.beixinyuanshenfenjianbie }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.zhongfushenfenjianbie < 1" v-show="false" label="中孚身份鉴别:">
                <span>{{ props.row.zhongfushenfenjianbie }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.zhongfushenfenjianbie >0" v-show="true" label="中孚身份鉴别:">
                <span>{{ props.row.zhongfushenfenjianbie }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.hanbangdayinkelushenji < 1" v-show="false" label="汉邦打印刻录审计:">
                <span>{{ props.row.hanbangdayinkelushenji }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.hanbangdayinkelushenji >0" v-show="true" label="汉邦打印刻录审计:">
                <span>{{ props.row.hanbangdayinkelushenji }}</span>
              </el-form-item>
            </el-card>
            <el-card class="box-card" style="width: 1100px;margin-top: 3px;background-color: #F2F6FC" shadow="hover">
              <el-form-item v-if="props.row.aerliulingpn < 1" v-show="false" label="A260PN:">
                <span>{{ props.row.aerliulingpn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.aerliulingpn >0" v-show="true" label="A260PN:">
                <span>{{ props.row.aerliulingpn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.cerliulingpn < 1" v-show="false" label="C260PN:">
                <span>{{ props.row.cerliulingpn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.cerliulingpn >0" v-show="true" label="C260PN:">
                <span>{{ props.row.cerliulingpn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.cmqilinglinglingfdn < 1" v-show="false" label="CM7000FDN:">
                <span>{{ props.row.cmqilinglinglingfdn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.cmqilinglinglingfdn >0" v-show="true" label="CM7000FDN:">
                <span>{{ props.row.cmqilinglinglingfdn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.mqiyaolingwudn < 1" v-show="false" label="M7105DN:">
                <span>{{ props.row.mqiyaolingwudn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.mqiyaolingwudn >0" v-show="true" label="M7105DN:">
                <span>{{ props.row.mqiyaolingwudn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.cperwulinglingdn < 1" v-show="false" label="CP2500DN:">
                <span>{{ props.row.cperwulinglingdn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.cperwulinglingdn >0" v-show="true" label="CP2500DN:">
                <span>{{ props.row.cperwulinglingdn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.cperwulingwudn < 1" v-show="false" label="CP2505DN:">
                <span>{{ props.row.cperwulingwudn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.cperwulingwudn >0" v-show="true" label="CP2505DN:">
                <span>{{ props.row.cperwulingwudn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.perwulingwu < 1" v-show="false" label="P2505:">
                <span>{{ props.row.perwulingwu }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.perwulingwu >0" v-show="true" label="P2505:">
                <span>{{ props.row.perwulingwu }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.psansanlingwudn < 1" v-show="false" label="P3305DN:">
                <span>{{ props.row.psansanlingwudn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.psansanlingwudn >0" v-show="true" label="P3305DN:">
                <span>{{ props.row.psansanlingwudn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.cmbawulingwudn < 1" v-show="false" label="CM8505DN:">
                <span>{{ props.row.cmbawulingwudn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.cmbawulingwudn >0" v-show="true" label="CM8505DN:">
                <span>{{ props.row.cmbawulingwudn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.mjiulinglingwudn < 1" v-show="false" label="M9005DN:">
                <span>{{ props.row.mjiulinglingwudn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.mjiulinglingwudn >0" v-show="true" label="M9005DN:">
                <span>{{ props.row.mjiulinglingwudn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.pwulinglinglingdn < 1" v-show="false" label="P5000DN:">
                <span>{{ props.row.pwulinglinglingdn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.pwulinglinglingdn >0" v-show="true" label="P5000DN:">
                <span>{{ props.row.pwulinglinglingdn }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.dsersanling < 1" v-show="false" label="DS-230:">
                <span>{{ props.row.dsersanling }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.dsersanling >0" v-show="true" label="DS-230:">
                <span>{{ props.row.dsersanling }}</span>
              </el-form-item>
            </el-card>
            <el-card class="box-card" style="width: 1100px;" shadow="hover">
              <el-form-item v-if="props.row.fsanlingyaoh < 1" v-show="false" label="F301H:">
                <span>{{ props.row.fsanlingyaoh }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.fsanlingyaoh >0" v-show="true" label="F301:">
                <span>{{ props.row.fsanlingyaoh }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.hongheidianyuanchazuo < 1" v-show="false" label="红黑电源:">
                <span>{{ props.row.hongheidianyuanchazuo }}</span>
              </el-form-item>
              <el-form-item v-if="props.row.hongheidianyuanchazuo >0" v-show="true" label="红黑电源:">
                <span>{{ props.row.hongheidianyuanchazuo }}</span>
              </el-form-item>
            </el-card>
            <el-card class="box-card" style="width: 1100px;background-color: #F2F6FC" shadow="hover">
              <el-form-item label="备注:">
                <span>{{ props.row.beizhu }}</span>
              </el-form-item>
            </el-card>
          </el-form>
        </template>
      </el-table-column>

      <el-table-column prop="danwei" label="单位" fixed="left" width="150"/>
      <el-table-column v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu','xiaoshou']" prop="iskaipiao" label="是否开票"/>
      <el-table-column v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu','xiaoshou']" prop="jine" label="金额" />
      <el-table-column v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu','xiaoshou']" prop="kaipiaoriqi" sortable label="开票日期" width="95">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.kaipiaoriqi).toString().substring(0,10) }}</span>
        </template>
      </el-table-column>
      <el-table-column v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu','xiaoshou']" sortable prop="huikuanjine" label="回款金额" width="95"/>
      <el-table-column v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu','xiaoshou']" prop="huikuanriqi" sortable label="回款日期" width="95">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.huikuanriqi).toString().substring(0,10) }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="ishetongjihui" label="合同寄回"/>
      <el-table-column prop="isjiqifachu" label="机器发出"/>
      <el-table-column prop="isbushu" label="是否部署"/>
      <el-table-column prop="bushuren" label="部署人"/>
      <el-table-column prop="hetongbianhao" label="合同编号"/>
      <el-table-column prop="lianxiren" label="联系人"/>
      <el-table-column prop="lianxidianhua" label="联系电话" width="100"/>
      <el-table-column prop="dizhi" label="地址" show-overflow-tooltip/>
      <el-table-column prop="zhanghuleixing" label="账户类型"/>
      <el-table-column
        :filters="[{text: '第一批', value: '第一批'}, {text: '第二批', value: '第二批'}, {text: '第三批', value: '第三批'}, {text: '第四批', value: '第四批'}, {text: '第五批', value: '第五批'}, {text: '第六批', value: '第六批'}, {text: '第七批', value: '第七批'}, {text: '第八批', value: '第八批'}, {text: '第九批', value: '第九批'}, {text: '第十批', value: '第十批'}, {text: '第十一批', value: '第十一批'}, {text: '第十二批', value: '第十二批'}, {text: '第十三批', value: '第十三批'}, {text: '第十四批', value: '第十四批'}, {text: '第十五批', value: '第十五批'}, {text: '第十六批', value: '第十六批'}, {text: '第十七批', value: '第十七批'}, {text: '第十八批', value: '第十八批'}, {text: '第十九批', value: '第十九批'}, {text: '第二十批', value: '第二十批'}, {text: '第二十一批', value: '第二十一批'}, {text: '第二十二批', value: '第二十二批'}, {text: '第二十三批', value: '第二十三批'}, {text: '第二十四批', value: '第二十四批'}, {text: '第二十五批', value: '第二十五批'}]"
        :filter-method="filterHandler"
        prop="pici"
        label="批次"/>
      <el-table-column prop="bushuriqi" label="部署日期" width="110">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.bushuriqi).toString().substring(0,10) }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="shangmencishu" label="上门次数"/>
      <el-table-column prop="hetongfuzeren" label="合同负责人" width="95"/>
      <el-table-column prop="jiqikuaidihao" label="机器快递号" width="130">
        <div slot-scope="scope" class="name-wrapper" @click="kuaidi(scope.row.jiqikuaidihao)">
          <el-link style="font-size: 12px" type="primary">{{ scope.row.jiqikuaidihao }}</el-link>
        </div>
      </el-table-column>
      <el-table-column prop="hetongkuaidihao" label="合同快递号" width="130">
        <div slot-scope="scope" class="name-wrapper" @click="kuaidi(scope.row.hetongkuaidihao)">
          <el-link style="font-size: 12px" type="primary">{{ scope.row.hetongkuaidihao }}</el-link>
        </div>
      </el-table-column>
      <el-table-column prop="weibaodaoqiri" label="维保到期日" width="85">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.weibaodaoqiri).toString().substring(0,10) }}</span>
        </template>
      </el-table-column>
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="zhujishuliang"
        label="主机数量"
        width="90"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="hfwuyaoling"
        label="HF510"
        width="90"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="hfwubaling"
        label="HF580"
        width="90"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="zfwuyaoling"
        label="ZF510"
        width="90"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="zfwuyaoqi"
        label="ZF517"
        width="90"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="chaoxiang"
        label="超翔L420-S0(同方台式)"
        width="190"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="chaorui"
        label="超锐-G41-UAR-00001(同方便携)"
        width="210"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="zhaoyang"
        label="昭阳CF03-MS088(联想便携)"
        width="200"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="zhongfusanheyi"
        label="中孚三合一"
        width="105"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="wanlihongsanheyi"
        label="万里红三合一"
        width="105"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="shuke"
        label="数科"
        width="65"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="jinshan"
        label="金山"
        width="65"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="yongzhong"
        label="永中"
        width="65"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="antian"
        label="安天"
        width="65"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="sanliuling"
        label="360杀毒"
        width="95"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="zhongfuzhushen"
        label="中孚主审"
        width="95"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="wanlihongzhushen"
        label="万里红主审"
        width="100"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="hanbangzhushen"
        label="汉邦主审"
        width="90"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="beixinyuanshenfenjianbie"
        label="北信源身份鉴别"
        width="120"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="zhongfushenfenjianbie"
        label="中孚身份鉴别"
        width="115"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="hanbangdayinkelushenji"
        label="汉邦打印刻录审计"
        width="130"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="aerliulingpn"
        label="A260PN"
        width="85"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="cerliulingpn"
        label="C260PN"
        width="85"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="cmqilinglinglingfdn"
        label="CM7000FDN"
        width="105"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="mqiyaolingwudn"
        label="M7105DN"
        width="95"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="cperwulinglingdn"
        label="CP2500DN"
        width="105"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="cperwulingwudn"
        label="CP2505DN"
        width="105"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="perwulingwu"
        label="P2505"
        width="75"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="psansanlingwudn"
        label="P3305DN"
        width="95"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="cmbawulingwudn"
        label="CM8505DN"
        width="105"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="mjiulinglingwudn"
        label="M9005DN"
        width="95"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="pwulinglinglingdn"
        label="P5000DN"
        width="95"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="dsersanling"
        label="DS-230"
        width="85"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="fsanlingyaoh"
        label="F301H"
        width="85"
      />
      <el-table-column
        :filters="numoption"
        :filter-method="filterHandler"
        prop="hongheidianyuanchazuo"
        label="红黑电源插座"
        width="105"
      />
      <el-table-column prop="beizhu" label="备注" show-overflow-tooltip/>
      <el-table-column v-if="checkPermission(['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','BUSHUTONGJI_DELETE','caiwu','kuguan','gongchengshi'])" fixed="right" label="操作" width="115px" align="center">
        <template slot-scope="scope">
          <el-button v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','kuguan','gongchengshi','caiwu']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)"/>
          <el-popover
            v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_DELETE']"
            :ref="scope.row.id"
            placement="top"
            width="180">
            <p>确定删除本条数据吗？</p>
            <div style="text-align: right; margin: 0">
              <el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
              <el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
            </div>
            <el-button slot="reference" type="danger" icon="el-icon-delete" size="mini"/>
          </el-popover>
          <!--<el-button v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT']" size="mini" type="primary" @click="uploads"><i class="el-icon-upload"/></el-button>-->
        </template>
      </el-table-column>
    </el-table>
    <!--分页组件-->
    <el-pagination
      :total="total"
      :current-page="page + 1"
      :page-sizes="[100, 200, 300, 400, 1000]"
      style="margin-top: 8px;"
      layout="total, prev, pager, next, sizes"
      @size-change="sizeChange"
      @current-change="pageChange"/>
  </div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/initData'
import initDict from '@/mixins/initDict'
import { del } from '@/api/bushutongji'
import { findkuaidi } from '@/api/bushutongji'
import { findGoodsByid, delGoods } from '@/api/goods'
import { parseTime } from '@/utils/index'
import eForm from './form'
import goodsForm from './goodsForm'
export default {
  components: { eForm, goodsForm },
  mixins: [initData, initDict],
  data() {
    return {
      gslx: [], // 字典
      ygmc: [], // 字典
      goods_name: [],
      numoption: [{ text: 1, value: 1 }, { text: 2, value: 2 }, { text: 3, value: 3 }, { text: 4, value: 4 }, { text: 5, value: 5 }, { text: 6, value: 6 }, { text: 7, value: 7 }, { text: 8, value: 8 }, { text: 9, value: 9 }, { text: 10, value: 10 }, { text: 11, value: 11 }, { text: 12, value: 12 }, { text: 13, value: 13 }, { text: 14, value: 14 }, { text: 15, value: 15 }, { text: 16, value: 16 }, { text: 17, value: 17 }, { text: 18, value: 18 }, { text: 19, value: 19 }, { text: 20, value: 20 }, { text: 21, value: 21 }, { text: 22, value: 22 }, { text: 23, value: 23 }, { text: 24, value: 24 }, { text: 25, value: 25 }, { text: 26, value: 26 }, { text: 27, value: 27 }, { text: 28, value: 28 }, { text: 29, value: 29 }, { text: 30, value: 30 }],
      row: null,
      queryList: {
        danwei: '',
        tjrqdate: '',
        quyu: '',
        zxhte: '',
        zdhte: '',
        iskaipiao: '',
        kprqdate: '',
        zxhke: '',
        zdhke: '',
        hkrqdate: '',
        htjc: '',
        jqfc: '',
        isbushu: '',
        bsr: '',
        lxr: '',
        zhlx: '',
        pc: '',
        bsrqdate: '',
        htfzr: '',
        shengshixian: '',
        zhujishuliang: '',
        hfwuyaoling: '',
        hfwubaling: '',
        zfwuyaoling: '',
        zfwuyaoqi: '',
        chaoxiang: '',
        chaorui: '',
        zhaoyang: '',
        zhongfusanheyi: '',
        wanlihongsanheyi: '',
        shuke: '',
        jinshan: '',
        yongzhong: '',
        antian: '',
        sanliuling: '',
        zhongfuzhushen: '',
        wanlihongzhushen: '',
        hanbangzhushen: '',
        beixinyuanshenfenjianbie: '',
        zhongfushenfenjianbie: '',
        hanbangdayinkelushenji: '',
        aerliulingpn: '',
        cerliulingpn: '',
        cmqilinglinglingfdn: '',
        mqiyaolingwudn: '',
        cperwulinglingdn: '',
        cperwulingwudn: '',
        perwulingwu: '',
        psansanlingwudn: '',
        cmbawulingwudn: '',
        mjiulinglingwudn: '',
        pwulinglinglingdn: '',
        dsersanling: '',
        fsanlingyaoh: '',
        hongheidianyuanchazuo: '',
        beizhu: ''
      },
      drawer: false,
      delLoading: false,
      delGoodsLoading: false,
      activities: null,
      goods: null,
      selDanwei: null, // 单位名称
      valTianjiashijian: null, // 添加日期
      selQuyu: null, // 区域
      expands: [], // 只展开一行放入当前行id
      getRowKeys(row) {
        return row.id
      },
      pickerOptions2: {
        shortcuts: [{
          text: '最近一周',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '最近一个月',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '最近三个月',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
            picker.$emit('pick', [start, end])
          }
        }]
      },
      downloadLoading: false,
      queryTypeOptions: [
        { key: 'createtime', display_name: '添加日期' },
        { key: 'sheng', display_name: '省' },
        { key: 'city', display_name: '城市' },
        { key: 'xian', display_name: '县区' },
        { key: 'danwei', display_name: '单位' },
        { key: 'jine', display_name: '金额' },
        { key: 'iskaipiao', display_name: '是否开票' },
        { key: 'kaipiaoriqi', display_name: '开票日期' },
        { key: 'huikuanjine', display_name: '回款金额' },
        { key: 'huikuanriqi', display_name: '回款日期' },
        { key: 'ishetongjihui', display_name: '合同寄回' },
        { key: 'isjiqifachu', display_name: '机器发出' },
        { key: 'isbushu', display_name: '是否部署' },
        { key: 'bushuren', display_name: '部署人' },
        { key: 'hetongbianhao', display_name: '合同编号' },
        { key: 'lianxiren', display_name: '联系人' },
        { key: 'lianxidianhua', display_name: '联系电话' },
        { key: 'dizhi', display_name: '地址' },
        { key: 'zhanghuleixing', display_name: '账户类型' },
        { key: 'pici', display_name: '批次' },
        { key: 'bushuriqi', display_name: '部署日期' },
        { key: 'shangmencishu', display_name: '上门次数' },
        { key: 'hetongfuzeren', display_name: '合同负责人' },
        { key: 'jiqikuaidihao', display_name: '机器快递号' },
        { key: 'hetongkuaidihao', display_name: '合同快递号' },
        { key: 'weibaodaoqiri', display_name: '维保到期日' },
        { key: 'zhujishuliang', display_name: '主机数量' }

      ],
      options: [{
        value: '广西',
        label: '广西',
        children: [{
          value: '南宁市',
          label: '南宁市',
          children: [{
            value: '兴宁区',
            label: '兴宁区'
          }, {
            value: '青秀区',
            label: '青秀区'
          }, {
            value: '江南区',
            label: '江南区'
          }, {
            value: '西乡塘区',
            label: '西乡塘区'
          }, {
            value: '良庆区',
            label: '良庆区'
          }, {
            value: '邕宁区',
            label: '邕宁区'
          }, {
            value: '武鸣区',
            label: '武鸣区'
          }, {
            value: '隆安县',
            label: '隆安县'
          }, {
            value: '马山县',
            label: '马山县'
          }, {
            value: '上林县',
            label: '上林县'
          }, {
            value: '宾阳县',
            label: '宾阳县'
          }, {
            value: '横县',
            label: '横县'
          }]
        }, {
          value: '柳州市',
          label: '柳州市',
          children: [{
            value: '城中区',
            label: '城中区'
          }, {
            value: '鱼峰区',
            label: '鱼峰区'
          }, {
            value: '柳南区',
            label: '柳南区'
          }, {
            value: '柳北区',
            label: '柳北区'
          }, {
            value: '柳江区',
            label: '柳江区'
          }, {
            value: '柳城县',
            label: '柳城县'
          }, {
            value: '鹿寨县',
            label: '鹿寨县'
          }, {
            value: '融安县',
            label: '融安县'
          }, {
            value: '融水苗族自治县',
            label: '融水苗族自治县'
          }, {
            value: '三江侗族自治县',
            label: '三江侗族自治县'
          }]
        }, {
          value: '桂林市',
          label: '桂林市',
          children: [{
            value: '秀峰区',
            label: '秀峰区'
          }, {
            value: '叠彩区',
            label: '叠彩区'
          }, {
            value: '象山区',
            label: '象山区'
          }, {
            value: '七星区',
            label: '七星区'
          }, {
            value: '雁山区',
            label: '雁山区'
          }, {
            value: '临桂区',
            label: '临桂区'
          }, {
            value: '阳朔县',
            label: '阳朔县'
          }, {
            value: '临川县',
            label: '临川县'
          }, {
            value: '全州县',
            label: '全州县'
          }, {
            value: '兴安县',
            label: '兴安县'
          }, {
            value: '永福县',
            label: '永福县'
          }, {
            value: '灌阳县',
            label: '灌阳县'
          }, {
            value: '龙胜各族自治县',
            label: '龙胜各族自治县'
          }, {
            value: '资源县',
            label: '资源县'
          }, {
            value: '平乐县',
            label: '平乐县'
          }, {
            value: '荔浦县',
            label: '荔浦县'
          }, {
            value: '恭城瑶族自治县',
            label: '恭城瑶族自治县'
          }]
        }, {
          value: '梧州市',
          label: '梧州市',
          children: [{
            value: '万秀区',
            label: '万秀区'
          }, {
            value: '长洲区',
            label: '长洲区'
          }, {
            value: '龙圩区',
            label: '龙圩区'
          }, {
            value: '苍梧县',
            label: '苍梧县'
          }, {
            value: '藤县',
            label: '藤县'
          }, {
            value: '蒙山县',
            label: '蒙山县'
          }, {
            value: '岑溪市',
            label: '岑溪市'
          }]
        }, {
          value: '北海市',
          label: '北海市',
          children: [{
            value: '海城区',
            label: '海城区'
          }, {
            value: '银海区',
            label: '银海区'
          }, {
            value: '铁山港区',
            label: '铁山港区'
          }, {
            value: '合浦县',
            label: '合浦县'
          }]
        }, {
          value: '防城港市',
          label: '防城港市',
          children: [{
            value: '港口区',
            label: '港口区'
          }, {
            value: '防城区',
            label: '防城区'
          }, {
            value: '上思县',
            label: '上思县'
          }, {
            value: '东兴市',
            label: '东兴市'
          }]
        }, {
          value: '钦州市',
          label: '钦州市',
          children: [{
            value: '钦南区',
            label: '钦南区'
          }, {
            value: '钦北区',
            label: '钦北区'
          }, {
            value: '灵山县',
            label: '灵山县'
          }, {
            value: '浦北县',
            label: '浦北县'
          }]
        }, {
          value: '贵港市',
          label: '贵港市',
          children: [{
            value: '港北区',
            label: '港北区'
          }, {
            value: '港南区',
            label: '港南区'
          }, {
            value: '平南县',
            label: '平南县'
          }, {
            value: '桂平市',
            label: '桂平市'
          }]
        }, {
          value: '玉林市',
          label: '玉林市',
          children: [{
            value: '玉州区',
            label: '玉州区'
          }, {
            value: '福绵区',
            label: '福绵区'
          }, {
            value: '容县',
            label: '容县'
          }, {
            value: '陆川县',
            label: '陆川县'
          }, {
            value: '博白县',
            label: '博白县'
          }, {
            value: '兴业县',
            label: '兴业县'
          }, {
            value: '北流市',
            label: '北流市'
          }]
        }, {
          value: '百色市',
          label: '百色市',
          children: [{
            value: '右江区',
            label: '右江区'
          }, {
            value: '田阳县',
            label: '田阳县'
          }, {
            value: '田东县',
            label: '田东县'
          }, {
            value: '平果县',
            label: '平果县'
          }, {
            value: '德保县',
            label: '德保县'
          }, {
            value: '那坡县',
            label: '那坡县'
          }, {
            value: '凌云县',
            label: '凌云县'
          }, {
            value: '乐业县',
            label: '乐业县'
          }, {
            value: '田林县',
            label: '田林县'
          }, {
            value: '西林县',
            label: '西林县'
          }, {
            value: '隆林各族自治县',
            label: '隆林各族自治县'
          }, {
            value: '靖西市',
            label: '靖西市'
          }]
        }, {
          value: '贺州市',
          label: '贺州市',
          children: [{
            value: '八步区',
            label: '八步区'
          }, {
            value: '平桂区',
            label: '平桂区'
          }, {
            value: '昭平县',
            label: '昭平县'
          }, {
            value: '钟山县',
            label: '钟山县'
          }]
        }, {
          value: '河池市',
          label: '河池市',
          children: [{
            value: '金城江区',
            label: '金城江区'
          }, {
            value: '南丹县',
            label: '南丹县'
          }, {
            value: '天峨县',
            label: '天峨县'
          }, {
            value: '凤山县',
            label: '凤山县'
          }, {
            value: '罗城仫佬族自治县',
            label: '罗城仫佬族自治县'
          }, {
            value: '环江毛南族自治县',
            label: '环江毛南族自治县'
          }, {
            value: '巴马瑶族自治县',
            label: '巴马瑶族自治县'
          }, {
            value: '都安瑶族自治县',
            label: '都安瑶族自治县'
          }, {
            value: '大化瑶族自治县',
            label: '大化瑶族自治县'
          }, {
            value: '宜州市',
            label: '宜州市'
          }]
        }, {
          value: '来宾市',
          label: '来宾市',
          children: [{
            value: '兴宾区',
            label: '兴宾区'
          }, {
            value: '忻城县',
            label: '忻城县'
          }, {
            value: '象州县',
            label: '象州县'
          }, {
            value: '武宣县',
            label: '武宣县'
          }, {
            value: '金秀瑶族自治县',
            label: '金秀瑶族自治县'
          }, {
            value: '合山市',
            label: '合山市'
          }]
        }, {
          value: '崇左市',
          label: '崇左市',
          children: [{
            value: '江州区',
            label: '江州区'
          }, {
            value: '扶绥县',
            label: '扶绥县'
          }, {
            value: '宁明县',
            label: '宁明县'
          }, {
            value: '龙州县',
            label: '龙州县'
          }, {
            value: '大新县',
            label: '大新县'
          }, {
            value: '天等县',
            label: '天等县'
          }, {
            value: '凭祥市',
            label: '凭祥市'
          }]
        }]
      }, {
        value: '其他省',
        label: '其他省',
        children: [{
          value: '其他城市',
          label: '其他城市',
          children: [{
            value: '其他县',
            label: '其他县'
          }]
        }]
      }]
    }
  },
  created() {
    this.$nextTick(() => {
      this.init()
      this.getDictMap('gslx,ygmc,pici')
    })
  },
  methods: {
    parseTime,
    checkPermission,
    beforeInit() {
      this.url = 'api/bushutongji'
      const sort = 'id,desc'
      this.params = { page: this.page, size: this.size, sort: sort }
      const query = this.query
      const type = query.type
      const value = query.value
      const queryList = this.queryList
      this.params['danwei'] = queryList.danwei
      this.params['iskaipiao'] = queryList.iskaipiao
      // this.params['riqi'] = parseTime(queryList.bsrqdate[0]).toString().substring(0, 10)
      this.params['sheng'] = this.queryList.shengshixian[0]
      this.params['city'] = this.queryList.shengshixian[1]
      this.params['xian'] = this.queryList.shengshixian[2]
      this.params['ishetongjihui'] = this.queryList.htjc
      this.params['isjiqifachu'] = this.queryList.jqfc
      this.params['isbushu'] = this.queryList.isbushu
      this.params['bushuren'] = this.queryList.bsr
      this.params['lianxiren'] = this.queryList.lxr
      this.params['zhanghuleixing'] = this.queryList.zhlx
      this.params['pici'] = this.queryList.pc
      this.params['hetongfuzeren'] = this.queryList.htfzr
      if (type && value) { this.params[type] = value }
      return true
    },
    subDelete(id) {
      this.delLoading = true
      del(id).then(res => {
        this.delLoading = false
        this.$refs[id].doClose()
        this.dleChangePage()
        this.init()
        this.$notify({
          title: '删除成功',
          type: 'success',
          duration: 2500
        })
      }).catch(err => {
        this.delLoading = false
        this.$refs[id].doClose()
        console.log(err.response.data.message)
      })
    },
    add() {
      this.isAdd = true
      this.$refs.form.dialog = true
    },
    edit(data) {
      this.isAdd = false
      const _this = this.$refs.form
      _this.form = {
        id: data.id,
        createtime: data.createtime,
        city: data.city,
        sheng: data.sheng,
        xian: data.xian,
        danwei: data.danwei,
        jine: data.jine,
        iskaipiao: data.iskaipiao,
        kaipiaoriqi: data.kaipiaoriqi,
        huikuanjine: data.huikuanjine,
        huikuanriqi: data.huikuanriqi,
        ishetongjihui: data.ishetongjihui,
        isjiqifachu: data.isjiqifachu,
        isbushu: data.isbushu,
        bushuren: data.bushuren,
        hetongbianhao: data.hetongbianhao,
        lianxiren: data.lianxiren,
        lianxidianhua: data.lianxidianhua,
        dizhi: data.dizhi,
        zhanghuleixing: data.zhanghuleixing,
        pici: data.pici,
        bushuriqi: data.bushuriqi,
        shangmencishu: data.shangmencishu,
        hetongfuzeren: data.hetongfuzeren,
        jiqikuaidihao: data.jiqikuaidihao,
        hetongkuaidihao: data.hetongkuaidihao,
        weibaodaoqiri: data.weibaodaoqiri,
        shengshixian: [data.sheng, data.city, data.xian],
        zhujishuliang: data.zhujishuliang,
        hfwuyaoling: data.hfwuyaoling,
        hfwubaling: data.hfwubaling,
        zfwuyaoling: data.zfwuyaoling,
        zfwuyaoqi: data.zfwuyaoqi,
        chaoxiang: data.chaoxiang,
        chaorui: data.chaorui,
        zhaoyang: data.zhaoyang,
        zhongfusanheyi: data.zhongfusanheyi,
        wanlihongsanheyi: data.wanlihongsanheyi,
        shuke: data.shuke,
        jinshan: data.jinshan,
        yongzhong: data.yongzhong,
        antian: data.antian,
        sanliuling: data.sanliuling,
        zhongfuzhushen: data.zhongfuzhushen,
        wanlihongzhushen: data.wanlihongzhushen,
        hanbangzhushen: data.hanbangzhushen,
        beixinyuanshenfenjianbie: data.beixinyuanshenfenjianbie,
        zhongfushenfenjianbie: data.zhongfushenfenjianbie,
        hanbangdayinkelushenji: data.hanbangdayinkelushenji,
        aerliulingpn: data.aerliulingpn,
        cerliulingpn: data.cerliulingpn,
        cmqilinglinglingfdn: data.cmqilinglinglingfdn,
        mqiyaolingwudn: data.mqiyaolingwudn,
        cperwulinglingdn: data.cperwulinglingdn,
        cperwulingwudn: data.cperwulingwudn,
        perwulingwu: data.perwulingwu,
        psansanlingwudn: data.psansanlingwudn,
        cmbawulingwudn: data.cmbawulingwudn,
        mjiulinglingwudn: data.mjiulinglingwudn,
        pwulinglinglingdn: data.pwulinglinglingdn,
        dsersanling: data.dsersanling,
        fsanlingyaoh: data.fsanlingyaoh,
        hongheidianyuanchazuo: data.hongheidianyuanchazuo,
        beizhu: data.beizhu
      }
      _this.dialog = true
    },
    addGoods(data) {
      this.isAdd = true
      this.$refs.goodsForm.dialog = true
      this.$refs.goodsForm.goodform.bushutongjiid = data
      this.$refs.goodsForm.row = this.row
    },
    editGoods(data) {
      console.log(data)
      this.isAdd = false
      const _this = this.$refs.goodsForm
      _this.goodform = {
        id: data.id,
        bushutongjiid: data.bushutongjiid,
        goodname: data.goodname,
        goodcount: data.goodcount,
        goodprice: data.goodprice
      }
      _this.dialog = true
    },
    subDeleteGoods(id) {
      this.delGoodsLoading = true
      delGoods(id).then(res => {
        this.delGoodsLoading = false
        this.$refs[id].doClose()
        this.dleChangePage()
        findGoodsByid(this.row.id).then(res => {
          this.goods = res
        })
        this.$notify({
          title: '删除成功',
          type: 'success',
          duration: 2500
        })
      }).catch(err => {
        this.delGoodsLoading = false
        this.$refs[id].doClose()
        console.log(err.response.data.message)
      })
    },
    kuaidi(kuaidi) {
      this.drawer = true
      findkuaidi(kuaidi).then(res => {
        this.activities = res.data
        console.log(this.activities)
      })
    },
    test(row, expandedRows) {
      this.row = row
      if (expandedRows.length) {
        this.expands = []
        if (row) {
          this.expands.push(row.id) // 只展开当前行id
        }
      } else { // 说明收起了
        this.expands = []
      }
    },
    handleChange(value) {
      console.log(value)
    },
    clearFilter() {
      this.$refs.filterTable.clearFilter()
    },
    filterHandler(value, row, column) {
      const property = column['property']
      return row[property] === value
    },
    zhujishuliangfilter(value, row, column) {
      const property = column['property']
      return row[property] === value
    },
    download() {
      this.downloadLoading = true
      import('@/utils/export2Excel').then(excel => {
        const tHeader = ['单位名称', '添加日期', '省份', '城市', '县区', '合同金额', '是否开票', '开票日期', '已回款金额', '回款日期', '合同寄回', '机器发出', '是否部署', '部署人', '合同编号', '联系人', '联系电话', '地址', '账户类型', '批次', '部署日期', '上门次数', '合同负责人', '机器快递号', '合同快递号', '维保到期日', '主机数量', 'HF510', 'HF580', 'ZF580', 'ZF517', '超翔L420-S0同方台式', '超锐-G41-UAR-00001(同方便携)', '昭阳CF03-MS088(联想便携)', '中孚三合一', '万里红三合一', '数科', '金山', '永中', '安天', '360杀毒', '中孚主审', '万里红主审', '汉邦主审', '北信源身份鉴别', '中孚身份鉴别', '汉邦打印刻录审计', 'A260PN', 'C260PN', 'CM7000FDN', 'M7105DN', 'CP2500DN', 'CP2505DN', 'P2505', 'P3305DN', 'CM8505DN', 'M9005DN', 'P5000DN', 'DS-230', 'F301H', '红黑电源隔离插座', '备注']
        const filterVal = ['danwei', 'createtime', 'sheng', 'city', 'xian', 'jine', 'iskaipiao', 'kaipiaoriqi', 'huikuanjine', 'huikuanriqi', 'ishetongjihui', 'isjiqifachu', 'isbushu', 'bushuren', 'hetongbianhao', 'lianxiren', 'lianxidianhua', 'dizhi', 'zhanghuleixing', 'pici', 'bushuriqi', 'shangmencishu', 'hetongfuzeren', 'jiqikuaidihao', 'hetongkuaidihao', 'weibaodaoqiri', 'zhujishuliang', 'hfwuyaoling', 'hfwubaling', 'zfwuyaoling', 'zfwuyaoqi', 'chaoxiang', 'chaorui', 'zhaoyang', 'zhongfusanheyi', 'wanlihongsanheyi', 'shuke', 'jinshan', 'yongzhong', 'antian', 'sanliuling', 'zhongfuzhushen', 'wanlihongzhushen', 'hanbangzhushen', 'beixinyuanshenfenjianbie', 'zhongfushenfenjianbie', 'hanbangdayinkelushenji', 'aerliulingpn', 'cerliulingpn', 'cmqilinglinglingfdn', 'mqiyaolingwudn', 'cperwulinglingdn', 'cperwulingwudn', 'perwulingwu', 'psansanlingwudn', 'cmbawulingwudn', 'mjiulinglingwudn', 'pwulinglinglingdn', 'dsersanling', 'fsanlingyaoh', 'hongheidianyuanchazuo', 'beizhu']
        const data = this.formatJson(filterVal, this.data)
        excel.export_json_to_excel({
          header: tHeader,
          data,
          filename: '部署统计表'
        })
        this.downloadLoading = false
      })
    },
    formatJson(filterVal, jsonData) {
      return jsonData.map(v => filterVal.map(j => {
        if (j === 'createtime' || j === 'kaipiaoriqi' || j === 'huikuanriqi' || j === 'bushuriqi' || j === 'weibaodaoqiri') {
          return parseTime(v[j]).substring(0, 10)
        } else {
          return v[j]
        }
      }))
    },
    uploads() {
      alert('上传功能开发中。。。')
    }
  }
}
</script>
